package com.mysafe.provision.model.intervaltype;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(schema = "sfe", name = "en_interval_type")
public class IntervalType implements Serializable, Comparable<IntervalType> {

	private static final long serialVersionUID = -2625144250604084511L;
	
	public static final Integer YEAR = 1;
	public static final Integer MONTH = 2;
	public static final Integer DAY = 3;
	
	@Id
	@Column(name = "id_interval_type")
	private Integer id;
	private String name;

	public IntervalType() {
	}
	
	public IntervalType(Integer id) {
		this.id = id;
	}
	
	public IntervalType(Integer id, String name) {
		this.id = id;
		this.name = name;
	}

	@Override
	public int compareTo(IntervalType o) {
		return this.name.compareToIgnoreCase(o.getName());
	}
	
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}
}